<!DOCTYPE html>
<html>
<head>
 @include("/include/_header.html", {'title':'选择部门'}){}
 
<link rel="stylesheet" href="${ctxPath}/bootstrap/css/bootstrap.min.css" media="all">
<link rel="stylesheet" href="${ctxPath}/treeview/css/bootstrap-treeview.min.css" media="all">
<script src="${ctxPath}/jquery/js/jquery.min.js"></script>
<script src="${ctxPath}/treeview/js/bootstrap-treeview.min.js"></script>

</head>
<body>
	<div class="layui-fluid">
		<div class="layui-row layui-col-space15">
			<div class="layui-col-md12">
				<div id="deptTree"></div>
			</div>
		</div>
	</div>

	<script type="text/javascript">
	
		layui.config({
			base : '${ctxPath}' + '/layuiadmin/' //静态资源所在路径
		}).extend({
			index : 'lib/index' //主入口模块
		}).use('index', function() {
	
			var $ = layui.$;
			
			$("#deptTree").treeview({
				data : ${treeData}
			});
			
			$('#deptTree').treeview('collapseAll', { silent: true });
			
			window.getValue = function() {
				var nodes = $('#deptTree').treeview('getSelected');
				if(nodes && nodes.length <= 0) {
					layer.alert("请选择相关部门");
					return;
				}
				var node = nodes[0];
				
				return node;
			}
			
	
		});
		
	</script>
</body>
</html>